<?php
/*
 * @ https://EasyToYou.eu - IonCube v11 Decoder Online
 * @ PHP 7.2 & 7.3
 * @ Decoder version: 1.1.6
 * @ Release: 10/08/2022
 */

// Decoded file for php version 71.
namespace OSS\Tests;

require_once __DIR__ . DIRECTORY_SEPARATOR . "Common.php";
class TestOssClientBase extends \PHPUnit_Framework_TestCase
{
    protected $ossClient;
    protected $bucket;
    public function setUp()
    {
        $this->bucket = Common::getBucketName() . rand(100000, 999999);
        $this->ossClient = Common::getOssClient();
        $this->ossClient->createBucket($this->bucket);
        Common::waitMetaSync();
    }
    public function tearDown()
    {
        if(!$this->ossClient->doesBucketExist($this->bucket)) {
            return NULL;
        }
        $objects = $this->ossClient->listObjects($this->bucket, ["max-keys" => 1000, "delimiter" => ""])->getObjectList();
        $keys = [];
        foreach ($objects as $obj) {
            $keys[] = $obj->getKey();
        }
        if(0 < count($keys)) {
            $this->ossClient->deleteObjects($this->bucket, $keys);
        }
        $uploads = $this->ossClient->listMultipartUploads($this->bucket)->getUploads();
        foreach ($uploads as $up) {
            $this->ossClient->abortMultipartUpload($this->bucket, $up->getKey(), $up->getUploadId());
        }
        $this->ossClient->deleteBucket($this->bucket);
    }
}

?>